﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace VAdvantage.Controls
{
    public partial class VLine : UserControl
    {

        public event RoutedEventHandler OnClick; 

        public VLine()
        {
            InitializeComponent();
        }


        public VLine(string text):this()
        {
            header.Text  = text;
        }

        private void OnExpandClick(object sender, MouseButtonEventArgs e)
        {
            if (OnClick != null)
            {
                OnClick(this,new  VLineEventArgs(true,Text));   
            }
            picE.Visibility = System.Windows.Visibility.Collapsed;
            picC.Visibility = System.Windows.Visibility.Visible;
        }

        private void OnCollapseClick(object sender, MouseButtonEventArgs e)
        {
            if (OnClick != null)
            {
                OnClick(this, new VLineEventArgs(false,Text));
            }
            picE.Visibility = System.Windows.Visibility.Visible;
            picC.Visibility = System.Windows.Visibility.Collapsed;
        }

        public String Text
        {
            get
            {
                return header.Text;
            }
            set
            {
                header.Text = value;
            }
        }


        internal  class VLineEventArgs : RoutedEventArgs
        {
            
            public VLineEventArgs()
            {
            }
            public VLineEventArgs(bool isExpand,String text)
            {
                IsExpand = isExpand;
                Name = text;
            }
            public bool IsExpand
            {
                get;
                set;
            }

            public String Name
            {
                get;
                set;
            }
        }

    }
}
